<?php
getHeader();
if (isset($_GET['pid']))
{
	$post = postClass::getPostByPid($_GET['pid']);
	if ($post == 'NO')
	{
		?>
<div id='content'>
<div class='tabs headTabs'><span>查看文章</span></div>
<div class='dataList'><span>不存在该文章</span></div>
</div>
		<?php
	}
	else
	{
		?>
<div id='content'>
<div class='tabs headTabs'><span>查看文章: <?php echo $post->name; ?></span>
</div>
<div class='dataList'>
<ul>
	<li>作者: <?php echo userProf::getUsernameByUid($post->owner); ?>&nbsp;&nbsp;&nbsp;&nbsp;发表时间:
	<?php echo date('Y年m月d日 H:i:s',$post->time); ?>

</ul>
<span> <?php echo $post->content; ?> </span></div>
	<?php
	if ($post->status == 'open' && isset($_SESSION['authPassed']))
	{
		$reply = postClass::getReplyByPid($post->pid);
		?>
<div class="dataList">
<ul>
<?php
if ($reply != 'NO')
{
	$i = 1;
	while ($arr = mysql_fetch_array($reply))
	{
		?>
	<li><?php echo $i.'楼    作者: '.userProf::getUsernameByUid($arr['postOwner']).'    回复时间: '.date('Y年m月d日 H:i:s',$arr['postTime']).'<br />'.$arr['postContent']; ?>
	</li>
	<?php
	}
}
?>
</ul>
<link rel="stylesheet"
	href="<?php echo PLUGINURL; ?>tinyEditor/style.css" />
<script type="text/javascript"
	src="<?php echo PLUGINURL; ?>tinyEditor/tinyeditor.js"></script>
<ul>
	<form action='?p=editPost' method="post" class='postForm'>
	<li><input type='hidden' name='postName' value='' /> <input
		type='hidden' name='postGroup' value='<?php echo $post->group; ?>' />
	<input type='hidden' name='postStatus'
		value='reply-<?php echo $post->pid; ?>' /></li>
	<li>回复: <textarea name='postContent' id="tinyInput"></textarea> <script
		type="text/javascript">
											var instance =new TINY.editor.edit('editor',{
											id:'tinyInput',
											width:584,
											height:175,
											cssclass:'te',
											controlclass:'tecontrol',
											rowclass:'teheader',
											dividerclass:'tedivider',
											controls:['bold','italic','underline','strikethrough','|','subscript','superscript','|',
			  									'orderedlist','unorderedlist','|','outdent','indent','|','leftalign',
			  									'centeralign','rightalign','blockjustify','|','unformat','|','undo','redo','n',
			  									'font','size','style','|','image','hr','link','unlink','|','cut','copy','paste','print'],
											footer:true,
											fonts:['Verdana','Arial','Georgia','Trebuchet MS'],
											xhtml:true,
											cssfile:'style.css',
											bodyid:'editor',
											footerclass:'tefooter',
											toggle:{text:'source',activetext:'wysiwyg',cssclass:'toggle'},
											resize:{cssclass:'resize'}
										});
										</script> </textarea></li>
	<li><br />
	<input type="submit" value="提交" class="button"
		style='margin-left: 40px;' onclick="instance.post();" /></li>
	</form>
</ul>
</div>
<?php
	}
	?></div>
	<?php
	}
}
else
{
	?>
<div id='content'>
<div class='tabs headTabs'><span>查看文章</span></div>
<div class='dataList'><span>请指定一篇文章进行查看.</span></div>
</div>
	<?php
}
getPanel();
getFooter();
?>